package com.starinside.wp.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2017/7/18
 * *******************************
 */
@Entity
@Data
@Table(name = "users", uniqueConstraints = {@UniqueConstraint(columnNames = "phone")})
@EqualsAndHashCode(callSuper = true)
public class AppUser extends Model {

    @Column
    private String name;

    @Column
    private String phone;

    @Column(name = "pwd")
    private String password;

    @Column
    private String company;

    @Column
    private String email;

    @Column
    private Integer status = 0;

    @Column(name = "ext")
    private String extension = "";

    @Column(name = "createTime")
    private Date created = new Date();

//    @Column(columnDefinition = " bit DEFAULT 1 COMMENT '摄像头权限开关' ")
//    private Boolean cameraEnabled = true;
//
//    @Column(columnDefinition = " bit DEFAULT 1 COMMENT '微信启用开关' ")
//    private Boolean wechatEnabled = true;
//
//    @Column(columnDefinition = " bit DEFAULT 1 COMMENT '模板消息开关' ")
//    private Boolean templateMsgEnabled = true;
//
//    @Column(columnDefinition = " bit DEFAULT 1 COMMENT '与老师聊天开关' ")
//    private Boolean teacherChatEnabled = true;

    @Transient
    private String relation;

    @Transient
    private String remark;

    @Transient
    private String rid;
//    @Transient
//    private String smsCode;

    public static AppUser of(String name, String phone, String company){
        AppUser appUser = new AppUser();
        appUser.setName(name);
        appUser.setPhone(phone);
        appUser.setCompany(company);
        return appUser;
    }

//    public static AppUser of_now(String name, String phone, String company,String password){
//        AppUser appUser = new AppUser();
//        appUser.setName(name);
//        appUser.setPhone(phone);
//        appUser.setCompany(company);
//        appUser.setPassword(password);
//        return appUser;
//    }
}
